<?php
class cls_General_Forms{
		
	public function code_block_starts($title,$subtitle=NULL,$data_blocks=NULL){ //center_content_format_start
		 ?>
			<!--insertion starts here!-->
			<div class="sscpost">
				<div class="sscpost-tl"></div>
				<div class="sscpost-tr"></div>
				<div class="sscpost-bl"></div>
				<div class="sscpost-br"></div>
				<div class="sscpost-tc"></div>
				<div class="sscpost-bc"></div>
				<div class="sscpost-cl"></div>
				<div class="sscpost-cr"></div>
				<div class="sscpost-cc"></div>
				<div class="sscpost-body">
				<div class="sscpost-inner sscarticle">
					<div class="sscpostmetadataheader">
						<h2 class="sscpostheader"><?php echo strtoupper($title)?></h2>
								<div class="cleared"></div>
					</div>
					
			<div class="sscpostcontent">
			<p style="text-align:justify;"></p>
			<?php if($subtitle!=NULL){ ?>
				<span style="font-size:16px;font-weight:bold; text-decoration: blink;"><center><?php echo strtoupper($title)?></center></span><br />
			<?php } ?>
			<p style="text-align:justify;"></p>
			<p style="text-align:justify;">
			<?php
	} //center_content_format_start
	
	public function code_block_ends(){//center_content_format_end
		?>
			</p>
			</div>
			<div class="cleared"></div>
			</div>
					<div class="cleared"></div>
				</div>
			</div>
			<br>
			<!--insertion ends here!-->
		 
		 <?php 
	  } //center_content_format_end  
  
	public function link_button ($button_name,$href_value){//object:link button
			?>
			<center>
			<span class="sscbutton-wrapper">
			<span class="sscbutton-l"> </span>
			<span class="sscbutton-r"> </span>
			<a class="sscbutton" href="<?php echo $href_value ?>"><?php echo $button_name?></a>
			</span></center>
			<?php
	} //object:link button

	public function submit_button ($button_name){
		//all forms should have the form name='form1'
			?>
			<center>
			<span class="sscbutton-wrapper">
			<span class="sscbutton-l"> </span>
			<span class="sscbutton-r"> </span>
			<a class="sscbutton" href="javascript:submitform()"><?php echo $button_name?></a>
			</span></center>
			<?php
	} //object:submit button 
	
	public function messages($title,$err_message){ //announcement
		 ?>
			<!--insertion starts here!-->
			<div class="sscpost">
				<div class="sscpost-tl"></div>
				<div class="sscpost-tr"></div>
				<div class="sscpost-bl"></div>
				<div class="sscpost-br"></div>
				<div class="sscpost-tc"></div>
				<div class="sscpost-bc"></div>
				<div class="sscpost-cl"></div>
				<div class="sscpost-cr"></div>
				<div class="sscpost-cc"></div>
				<div class="sscpost-body">
				<div class="sscpost-inner sscarticle">
					<div class="sscpostmetadataheader">
						<h2 class="sscpostheader">Message:<?php echo $title?></h2>
								<div class="cleared"></div>
					</div>
					
			<div class="sscpostcontent">
			<p style="text-align:justify;"></p>
			<span style="font-size:16px;font-weight:bold; text-decoration: blink;"><center><?php echo $err_message?></center></span><br />
			</div>
			<div class="cleared"></div>
			</div>

					<div class="cleared"></div>
				</div>
			</div>
			<br>
			<!--insertion ends here!-->
		 
		 <?php 
	  } //mesages for erro reporting(pre-formatted,code_blocks not needed)
      public function login_form(){                                                    
          ?><center>
           <table class="cog_etry"> 
             <caption class="cog_etry">LOG-IN FORM</caption> 
              <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST"> 
                <tr> <td>Username</td> <td><input name="username" type="text" value=""></input></td></tr>
                <tr> <td>Password</td> <td><input name="password" type="password" value=""></input></td></tr>
                 <tr> <td>Profile ID</td> <td><input name="profile_id" type="text" value=""></input></td></tr>
                <tr> <td>Action</td> <td><input type="submit" name="submit" value="LOGIN"></td>
              </form>
         </table>
            </center>
     <?php }
     public function header_form($title,$others){
         ?>
          <p>SORSOGON STATE COLLEGE<br>
          SORSOGON CAMPUS<br>
          <?php echo $title; ?><br>
          <?php echo $others;?> </p>
    
         <?php
     }
     
  }

 
class admission_forms{
   /* function log_profile($choices,$religion,$status){?>
                    <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                    <table border="0" align="left" style="margin-top:1em;;margin:1em 20% 0 20%;padding-left:2em;">
                        <caption class="cog_etry">APPLICATION FOR ADMISSION CREDENTIALS</caption>
                        <tr><td colspan="4"><i>Please hover your mouse pointer on a specific field to provide you with hints of valid inputs.</i></td></tr>
                        <tr><td colspan="4"><hr></td></tr>
                          <tr><td >Name:</td><td colspan="4"><input type=text title="First Name, Ex: Juan" name="fname" size="30"></input><input type=text title="Middle Name" name="mname" title="middle name" size="25"></input><input type="text" title="Last Name" name="sname" size="20"></input></td></tr>
                        <tr><td >Status:</td><td><select name="remarks"><?php foreach($status as $remarks){echo "<option value='".$remarks['code']."'>".$remarks['description']."</option>";} ?></select></td><td >Age:</td><td><input type="text" name="age" size="20"</input></td></tr>
                        <tr><td >Date of Birth:</td><td><input id="check_date" onblur="validate_date(this.value);" title="Format: mm-dd-yyyy; Ex: 12-12-2013" type="text" name="d_birth" size="40"></input></td>
                        <td >Gender:</td><td><input type="radio" name="gender" value="MALE" checked></input>MALE<input type="radio" name="gender" value="FEMALE"</input>FEMALE</td></tr>
                        <tr><td colspan="4"><hr></td></tr>
                        
                        <tr><td >Mailing Address:</td><td><input type="text" name="m_address" size="40"></input></td><td >CP Number:</td><td><input type="text" name="c_number" size="20"></input></td></tr>
                        <tr><td >Home Address:</td><td><input type="text" name="h_address" size="40"></input></td><td >Height(in):</td><td><input type="text" name="height" title="Express in f'in'': Example: 5'3''" size="20"></input></td></tr>
                        <tr><td >E-mail address</td><td><input type="text" name="e_address" size="40"></input></td><td >Weight(kgs):</td><td><input type=text name="weight" title="Express in kgs: Example: 55" size="20"></td></tr>
                        <tr><td >Nationality:</td><td><input type="text" name="nationality" size="40" value="FILIPINO"></input></td><td >Religion:</td><td><select name="religion" style="width: 13em"><option value="Roman Catholic">Roman Catholic</option><?php foreach($religion as $mao){echo "<option value='".$mao['description']."'>".$mao['description']."</option>";}?></select></td></tr>
                        <tr><td>Father's Name:</td><td><input type="text" name="f_name" size="40"></input></td><td>Occupation</td><td><input type="text" name="f_occupation" size="20"></input></td></tr>
                        <tr><td>Mother's Name:</td><td><input type="text" name="m_name" size="40"></input></td><td>Occupation</td><td><input type="text" name="m_occupation" size="20"></input></td></tr>
                        <tr><td>Guardian's Name:</td><td><input type="text" name="g_name" size="40"></input></td><td>Relationship</td><td><input type="text" name="relationship" size="20"></input></td></tr>    
                        <tr><td>First Choice:</td><td colspan="3"><center><select name="f_choice"><?php foreach($choices as $courses){?><option value="<?php echo $courses['degreeid'];?>"><?php echo $courses['degreename'];}?></option></center></td><td></td><td></td></tr>    
                        <tr><td>Second Choice:</td><td colspan="3"><center><select name="s_choice"><?php foreach($choices as $courses){?><option value="<?php echo $courses['degreeid'];?>"><?php echo $courses['degreename'];}?></option><center></td><td></td><td></td></tr>    
                        <tr><td>Third Choice:</td><td colspan="3"><center><select name="t_choice"><?php foreach($choices as $courses){?><option value="<?php echo $courses['degreeid'];?>"><?php echo $courses['degreename'];}?></option><center></td><td></td><td></td></tr>     
                        <tr><td>Action:</td><td colspan="4"><center><input type="reset"                style="width:200px;height:30px;font-weight:bolder;margin-left:20px;" value="Clear"></input>
                                            <input type="submit" disabled name="submit" id="agreement" style="width:200px;height:30px;font-weight:bolder;margin-left:20px;" value="Proceed to Course Choices"></input></center></td></tr>  
                    </table>                                                                                                                                                         
                    </form>
                    <center>
                     <table><tr><td><input id="note" onclick="agreement_status(this.checked);" type="checkbox"></input></td><td>This pre-registration is valid only upon official confirmation of the applicant by paying the the admission fee at Sorsogon State College office. </td> </tr></table>  
                    </center>
                     <?php 
    } */
    
     function admission_receipt_print($data){
       ?>

               <img src="icon/logo.jpg" alt="" id="logo" style="left:2.5in;position: fixed;">
               <table align="center">
                   <tr><td align="center">Sorsogon State College</td></tr>
                   <tr><td align="center">Magsaysay St., Sorsogon City</td></tr>
                </table>
                <BR>
       
       <table align="center">
            <tr><th align="center">ONLINE APPLICATION FOR ADMISSION</th></tr>
       </table>
       
             <table align="center"><tr><th style="font-style: italic;">Personal Information</th></tr></table>
             
<div id="enter_your_item_codes_security_here" style="left:2in;position: fixed;">

Enter codes

</div>

                    <table align="center">
              <tr><td>Name</td><td>:</td><td style="font-weight: bolder"><?php echo $data['name'];?></td></tr>
               <tr><td>Gender</td><td>:</td><td style="font-weight: bolder"><?php echo $data['name'];?></td></tr>
               <tr><td>Address</td><td>:</td><td style="font-weight: bolder"><?php echo $data['address'];?></td></tr>
               <td>Registration No</td><td>:</td><td style="font-weight: bolder"><?php echo $data['registration_no'];?></td></tr>
               <tr><td>Date of Registration</td><td>:</td><td style="font-weight: bolder"><?php echo $data['date_of_registration'];?></td></tr>
               <tr><td colspan="3"></td><td><hr></td></tr>
                </table>
                
                  <table align="center"><tr><th style="font-style: italic;">Course Options Details</th></tr></table>
              <table align="center">
              <tr><td>First Choice</td><td>:</td><td style="font-weight: bolder"><?php echo $data['first_choice'];?></td></tr>
               <tr><td>Second Choice</td><td>:</td><td style="font-weight: bolder"><?php echo $data['second_choice'];?></td></tr>
               <tr><td>Third Choice</td><td>:</td><td style="font-weight: bolder"><?php echo $data['third_choice'];?></td></tr>
               </table>
               
               
               <tr><td colspan="3"></td><td><hr style="border-bottom: 2px dotted #000; height: 0;"></td></tr>
                </table>
       
                                           

       <?php
     }   
     function log_profile($choices,$religion,$status){?>
                    <form name="form1" action="<?php echo "print_container.php";?>" method="POST">
                    <table border="0" align="left" style="margin-top:1em;;margin:1em 20% 0 20%;padding-left:2em;font-size: 13pt;font-family: 'Times New Roman', Times, serif;;">
                        <caption class="cog_etry">APPLICATION FOR ADMISSION CREDENTIALS</caption>
                        <tr><td colspan="4"><i>Please hover your mouse pointer on a specific field to provide you with hints of valid inputs.</i></td></tr>
                        <tr><td colspan="4" align="center"><hr></td></tr>
                        
                         <tr><td colspan="4" style="text-align: center;font-size: 20pt;color:black;background-color:#D8D8D8;">
                                <p style="text-align: left;margin-left: 3em">Personal/Required Information<img style="float:right;margin-bottom: 3pt;" src="icon/personal.jpg" alt=""></p>
                                
                                </td>
                             <td></td></tr>
                         
                        <tr><td><br></td></tr>
                        
                          <tr><td colspan="4">First Name:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type=text title="First Name, Ex: Juan" name="fname" size="60"></input></td></tr>
                          
                          <tr><td colspan="4">Middle Name: &nbsp<input type=text title="Middle Name" name="mname" title="middle name" size="60"></input></td></tr>
                          

                           <tr><td colspan="4">Last Name:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" title="Last Name" name="sname" size="60"></input></td></tr>
                    
                        <tr><td colspan="4">Age: &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                        <input type="text" name="age" size="20"</input></td></tr>
                       
                        <tr><td colspan="4">Date of Birth:&nbsp&nbsp&nbsp<input id="check_date" onblur="validate_date(this.value);" title="Format: mm-dd-yyyy; Ex: 12-12-2013" type="text" name="d_birth" size="40"></input></td></tr>
                                                
                        <tr><td >Gender:</td><td><input type="radio" name="gender" value="MALE" checked></input>MALE<input type="radio" name="gender" value="FEMALE"</input>FEMALE</td></tr>
                        
                       <tr><td >CP Number:</td><td>&nbsp&nbsp&nbsp&nbsp<input type="text" name="c_number" size="20"></input></td></tr>
                        
                         <tr><td colspan="4">Mailing Address:&nbsp&nbsp&nbsp<input type="text" name="m_address" size="45"></input></td></tr>
                         
                         <tr><td colspan="4">Home Address:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="h_address" size="45"></input></td></tr>
                        
                           <tr><td colspan="4">E-mail address:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="e_address" size="45"></input></td></tr>
                        
                        <tr><td >Status:</td><td>&nbsp&nbsp&nbsp&nbsp&nbsp<select name="remarks"><?php foreach($status as $remarks){echo "<option value='".$remarks['code']."'>".$remarks['description']."</option>";} ?></select></td></tr>
                        
                        <tr><td colspan="4"><hr></td></tr>
                        
                         <tr><td colspan="4" style="text-align: center;font-size: 20pt;color:black;background-color:#D8D8D8;">
                                <p style="text-align: left;margin-left: 3em">Relevant/Optional Information<img style="float:right;margin-bottom: 3pt;" src="icon/relevant.jpg" alt=""></p>
                                 </td>
                             <td></td></tr>
                         
                        <tr><td><br></td></tr>
                       
                        </tr><td >Height(in):</td><td><input type="text" name="height" title="Express in f'in'': Example: 5'3''" size="20"></input></td></tr>
                        
                     <tr><td >Weight(kgs):</td><td><input type=text name="weight" title="Express in kgs: Example: 55" size="20"></td></tr>
                     
                        <tr><td >Nationality:</td><td><input type="text" name="nationality" size="40" value="FILIPINO"></input></td></tr>
                        
                        <tr><td >Religion:</td><td><select name="religion" style="width: 13em"><option value="Roman Catholic">Roman Catholic</option><?php foreach($religion as $mao){echo "<option value='".$mao['description']."'>".$mao['description']."</option>";}?></select></td></tr>
                                                
                        <tr><td>Father's Name:</td><td><input type="text" name="f_name" size="40"></input></td><td>Occupation</td><td><input type="text" name="f_occupation" size="20"></input></td></tr>
                        
                        <tr><td>Mother's Name:</td><td><input type="text" name="m_name" size="40"></input></td><td>Occupation</td><td><input type="text" name="m_occupation" size="20"></input></td></tr>
                        
                        <tr><td>Guardian's Name:</td><td><input type="text" name="g_name" size="40"></input></td><td>Relationship</td><td><input type="text" name="relationship" size="20"></input></td></tr>    
                        
                        <tr><td colspan="4"><hr></td></tr>
                        
                        <tr><td colspan="4" style="text-align: center;font-size: 20pt;color:black;background-color:#D8D8D8;">
                                <p style="text-align: left;margin-left: 3em">Course Options<img style="float:right;margin-bottom: 3pt;" src="icon/career.jpg" alt=""></p>
                                
                                </td>
                             <td></td></tr>
                         
                        <tr><td><br></td></tr>
                        
                        
                        <tr><td colspan="4">First Choice:&nbsp&nbsp&nbsp&nbsp <select name="f_choice"><?php foreach($choices as $courses){?><option value="<?php echo $courses['degreeid'];?>"><?php echo $courses['degreename'];}?></option></td></tr> 
                     
                        <tr><td colspan="4"><br></td></tr>
                           
                        <tr><td colspan="4">Second Choice:&nbsp<select name="s_choice"><?php foreach($choices as $courses){?><option value="<?php echo $courses['degreeid'];?>"><?php echo $courses['degreename'];}?></option></td></tr>
                        
                         <tr><td colspan="4"><br></td></tr>    
                        <tr><td colspan="4">Third Choice:&nbsp&nbsp&nbsp&nbsp<select name="t_choice"><?php foreach($choices as $courses){?><option value="<?php echo $courses['degreeid'];?>"><?php echo $courses['degreename'];}?></option></td></tr>   
                        
                         <tr><td colspan="4"><br><br></td></tr>
                            
                        
                    <tr><td colspan="4"><input id="note" onclick="agreement_status(this.checked);" type="checkbox"></input><i>This pre-registration is valid only upon official confirmation of the applicant by paying the the admission fee at Sorsogon State College office.</i></td></tr>
                    
                      <tr><td colspan="4"><br><br></td></tr>
                     <tr><td>Action:</td><td colspan="4"><center><input type="reset" style="width:200px;height:30px;font-weight:bolder;margin-left:20px;text-align: justify;" value="Clear"></input> <input type="submit" disabled name="submit" id="agreement" style="width:200px;height:30px;font-weight:bolder;margin-left:20px;" value="Confirm and Dowload Receipt"></input></center></td></tr>  
                      
                    </table>  
                                                                                                                                                                       
                    </form>

                     <?php 
    }
    
    function show_admission_profile($data){
                ?>
                <center>
                    <table width="80%" class="border_all">
                        <caption class="cog_etry">Applicants for Admission</caption>
                        <tr class="title"><td>Count</td><td>Name</td><td>Address</td><td>First Choice</td><td>Second Choice</td><td>Third Choice</td><td>Gender</td><td>Status</td></tr>
                        <?php
                        $count=1;
                        foreach($data as $profile){
                         ?>
                           <tr><td><?php echo $count?></td><td><?php echo $profile['name']?></td><td><?php echo $profile['h_address']?></td><td><?php echo admin_functions::replace_code_to_string($profile['f_choice']);?></td><td><?php echo admin_functions::replace_code_to_string($profile['s_choice'])?></td><td><?php echo admin_functions::replace_code_to_string($profile['t_choice']);?></td><td><?php echo $profile['gender'];?></td><td><?php echo admin_functions::replace_code_to_string_status($profile['remarks']);?></td></tr>
                         <?php   
                         $count++;
                        }?>
                    </table> 
                </center>               
                <?php
    }
    
    function entry_form_exam_new(){
         ?>
                <center>
                    <table class="cog_etry">
                    <caption class="cog_etry">New Exam</caption>
                              <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                             <tr><td>Exam Name</td><td><input type="text" name="exam_name"></input></td></tr>
                             <tr><td>No. of Items</td><td><input type="text" name="no_item"></input></td></tr>
                              <tr><td>No. of Choices</td><td><input type="text" name="no_choices"></input></td></tr>
                               <tr><td>Action</td><td>  <input type="submit" name="submit" value="ADD EXAM"></input> </td></tr>
                                                         
                    </table> 
                </center>               
                <?php
        
    }
    function add_items_exam($data){
               ?>
                <center>
                    <table class="cog_etry">
                    <caption class="cog_etry">Exam Names</caption>  
                    <?php foreach($data as $exam_name){ 
                    ?>                      
                        <tr><td>Exam Name</td><td><a href="main.php?page=admission&spec=addquestion&action=ask&subj=<?php echo $exam_name['code_exam'];?>"><?php echo $exam_name['name_exam'];?></a></td></tr> 
                       <?php }?>     
                    </table> 
                </center>               
                <?php
    } 
    
    function add_questions($exam){
        ?><table>
         <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
        <?php  
        $options = array("a","b","c","d","e","f");
        $count=1;
        foreach($exam as $questions){
            ?>
                 <tr><td><?php echo $count;?></td><td><textarea cols="150" rows="8" name="<?php echo "question_".$count?>"><?php echo $questions['main_q'];?></textarea> </td></tr>
                 <?php
                  foreach($options as $option){ 
                       if(is_null($questions['opt_'.$option])){ 
          
                       }elseif($questions['opt_'.$option]==""){
                           ?>
                            <tr><td><?php echo $option;?></td><td><input type="text" name="<?php echo $option."_".$count;?>"></input></td></tr>
                           <?php
                       }else{      
                             ?>
                             <tr><td><?php echo $option;?></td><td><input type="text" name="<?php echo $option."_".$count;?>" value="<?php echo $questions['opt_'.$option];?>"></input></td></tr>
                           <?php
                       }
                  }
                  ?>
                  <tr><td>Answer</td><td><select name="<?php echo "answer_".$count;?>">
                                            <?PHP   if($questions['cor_ans']==" " || $questions['cor_ans']==""){
                                                               ?>
                                                               <option value="<?php echo " "?>" selected><?php echo "--"?></option> 
                                                               <?php
                                                    }else{
                                                     ?>
                                                               <option value="<?php echo $questions['cor_ans'];?>" selected><?php echo $questions['cor_ans'];?></option> 
                                                               <?php
                                                     }    
                                      
                                                        foreach($options as $option){
                                                             if(is_null($questions['opt_'.$option])){
                                                                    #avoid non-existing choices 
                                                             }else{
                                                                ?>
                                                                 <option value="<?php echo $option?>"><?php echo $option?></option> 
                                                                <?php 
                                                             }           
                                                        }
                                                        ?>
                                                </select>
                  </td></tr>

                  <?php
                      $count++; //used as iterator 
        }
             ?>
              <tr><td>Action</td><td> <input type="submit" value="ADD ITEMS" name="submit"></input></td></tr>
              <input type="hidden" name="subj" value="<?php echo $_REQUEST['subj']; ?>"></input>
              <input type="hidden" name="count" value="<?php echo $count; ?>"></input>
        </table>
        <?php  

    }
    
    function show_exam_to_take($exam_name){
                 ?>
                <center>
                    <table>
                    <caption>Examination Subjects</caption>
                              <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                             <tr><td>Exam Name</td><td>
                                <select name="exam_name">
                                <?php
                                foreach($exam_name as $exam){
                                ?>
                                    <option value="<?php echo $exam['code_exam'];?>"><?php echo $exam['name_exam'];?></option>
                                <?php
                                    }
                                ?>
                                </select>
                             
                             </td></tr>
                                <tr><td>ID NO</td><td>  <input type="text" name="student_id"></input> </td></tr>

                               <tr><td>Action</td><td>  <input type="submit" name="submit" value="TAKE EXAM"></input> </td></tr>
                                                         
                    </table> 
                </center>               
                <?php
    }
    
    function render_questions($item,$student_id,$exam_name){
        $options = array("a","b","c","d","e","f");
        ?>
  <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
        <table>
        <?php
        $count=1;
            foreach($item as $items){
        ?>
            <input type="hidden" name="item_no[]" value="<?php echo $items['item_no']?>">
            
            <tr><td><?php echo $count.". ".$items['main_q']?></td></tr>
               <?php foreach($options as $option){
                        if(is_null($items['opt_'.$option])){
                            
                        }else{
                             ?>
                              <tr><td><input type="radio" name="<?php echo "ans_".$items['no']?>" value="<?php echo $option?>">
                                                                <?php echo $option.". ".$items['opt_'.$option];?></td></tr>                
                               <?php
                        }                    
                      }
                ?>
        
            <tr><td>&nbsp;</td></tr>
        <?php
        $count++;
            }
            ?>
            <input type="hidden" name="student_id" value="<?php echo $student_id;?>"></input>
            <input type="hidden" name="exam_name" value="<?php echo $exam_name;?>"></input>
             <input type="hidden" name="count" value="<?php echo $count;?>"></input>
            <tr><td><input type="submit" name="submit" value="DONE"></input></td></tr>
              </table>
              </form>
            <?php
    }
    
    function show_result_exam($names){
          ?>
          <center>
          <table width="75%" class="border_all">
            <caption class="cog_etry">Examination Result</caption>
            <tr class="title"><td>No</td><td>Student ID</td><td>Name</td><td>Score</td><td>Rating</td><td>Remarks</td></tr>
            <?php
            $count=1;
            foreach($names as $name){
                ?>
               <tr><td><?php echo $count;?></td><td><?php echo $name['student_id'];?></td><td><?php echo $name['name'];?></td><td><?php echo $name['score'];?></td><td><?php echo $name['rating']?></td><td><?php echo $name['remarks'];?></td></tr>  
                <?php
                $count++;
            }
            ?>
          </table>
          </center>
          <?php
    }
               
}


class admin_forms{
    public function add_user($user_type){ 
        $_SESSION['page']="Add Users";
        ?>
      <center> 
        <table class="cog_etry">
           <caption class="cog_etry">Add Users Form</caption>      
            <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST"> 
                <tr><td>Username</td>   <td><input type="text" name="username"></input></td></tr>
                <tr><td>Password</td>   <td><input type="password" name="password"></input></td></tr>
                <tr><td>User Type</td>  <td><select name="user_type">
                                             <?php foreach($user_type as $option){
                                                 echo "<option value=".$option['code'].">".$option['description']."</option>";
                                             }?>       
                                            </select></td></tr>
                <tr><td>Name</td><td><input type="text" name="fullname"></input></td></tr>
                <tr><td>Profile ID</td><td><input type="text" name="profile_id"></input></td></tr>
                <tr><td>Position</td><td><input type="text" name="position"></input></td></tr>
                <tr><td>Phone</td><td><input type="text" name="phone"></input></td></tr>
                <tr><td>Email Address</td><td><input type="text" name="email"></input></td></tr> 
                <tr><td>Action</td><td><input type="submit" name="submit" value="Add User"></td></tr>
            </form>
        </table>
       </center>  
        <?php
    }
    
    public function edit_user($user_type,$profile){
        $_SESSION['page']="Edit Users";
            ?>
       <center>     
        <table>
            <caption class="cog_etry">Users List</caption>
            <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
            <input type="hidden" name="old_username" value="<?php echo $profile[0]['username'];?>"></input> 
                <tr><td>Username</td>   <td><input type="text" name="username" value="<?php echo $profile[0]['username'];?>"></input></td></tr>
                <tr><td>Password</td>   <td><input type="password" name="password"></input></td></tr>
                <tr><td>User Type</td>  <td><select name="user_type">
                                             <?php /* foreach($user_type as $option){
                                                 if($option['code']==$profile[0]['user_type']){
                                                   echo "<option value=".$option['code']." selected>".$option['description']."</option>";   
                                                 }else{
                                                     echo "<option value=".$option['code'].">".$option['description']."</option>"; 
                                                 }
                                                
                                             }*/?> 
                                                 <option value="7">Admission</option>  
                                            </select></td></tr>
                <tr><td>Name</td><td><input type="text" name="fullname" value="<?php echo $profile[0]['name'];?>"></input></td></tr>
                <tr><td>Position</td><td><input type="text" name="position" value="<?php echo $profile[0]['positions'];?>"></input></td></tr>
                <tr><td>Phone</td><td><input type="text" name="phone" value="<?php echo $profile[0]['phone'];?>"></input></td></tr>
                <tr><td>Profile ID</td><td><input type="text" name="profile_id" value="<?php echo $profile[0]['profile_id'];?>"></input></td></tr>
                <tr><td>Email Address</td><td><input type="text" name="email" value="<?php echo $profile[0]['email'];?>"></input></td></tr> 
                <tr><td>Action</td><td><input type="submit" name="submit" value="Update User"></td></tr>
            </form>
        </table>
       </center> 
        <?php
    }
    
    public function view($row){
        $_SESSION['page']="Edit/Delete Users";
        #this function shows all the users for possible deletion and edit?>
    <center>
        <table align="center" width="80%">
            <caption class="cog_etry">List of Users</caption>       
            <tr><td colspan="7"><hr></td></tr>
            <tr>
                <td align="center">Delete</td>
                <td align="center">Edit</td>
                <td align="center">Full Name</td>
                <td  align="center">Position</td>
                <td align="center">User Name</td>
                <td align="center">Profile Id</td> 
                <td align="center">Phone</td>
                <td align="center">Email</td>
            </tr>
              <tr><td colspan="7"><hr></td></tr>
        <?php
      foreach($row as $data){
            ?>
            <tr>
                <!--icon here for delete!-->
                <td align="center"><a href="main.php?page=admin&spec=delete&action=ask&username=<?php echo $data['username']?>" title="delete user"><img src="icon/icon_del.jpg"></a></td>
                <!--icon here for delete!-->
                <td align="center"><a href="main.php?page=admin&spec=edit&action=ask&username=<?php echo $data['username']?>" title="edit user"><img src="icon/icon_edit.jpg"></a></td>
                <td><?php echo $data['name']?></td>
                 <td><?php echo $data['position']?></td>
                  <td><?php echo $data['username']?></td>
                   <td><?php echo $data['profile_id']?></td>  
                   <td><?php echo $data['phone']?></td> 
                   <td><?php echo $data['email']?></td>     
            </tr>
            <?php }?> </table>  </center>    
            <?php
        
    }
    
    public function assessment_names($assessment){
        ?>
        <table class="listings">
            <tr>
              <th colspan="2">Fees</th>                 <th colspan="5">Amounts</th>  
            </tr>
            <tr>  
              <th>No<th>Assessment Description</th><th>1st Year</th><th>2nd Year</th><th>3rd Year</th><th>4th Year</th><th>5th Year</th>
            </tr>
        
            <form name="form1" id="subjects_assess" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
       <?php     
       $count=1;
       foreach($assessment as $to_show){  ?>
               <tr> <input type="hidden" name="descr_<?php echo $to_show['AssessmentID']?>" value="<?php echo $to_show['AssessmentName']?>"></input>
               <th><input   type="checkbox" name="total_assessment[]" value="<?php echo $to_show['AssessmentID'];?>"><?php //echo $count;?></input></th>
                   <td><?php echo $to_show['AssessmentName']?></td>
                   <td><input type="text" name="first_<?php echo $to_show['AssessmentID'];?>"></input></td>
                   <td><input type="text" name="second_<?php echo $to_show['AssessmentID'];?>"></input></td>
                   <td><input type="text" name="third_<?php echo $to_show['AssessmentID'];?>"></input></td>
                   <td><input type="text" name="fourth_<?php echo $to_show['AssessmentID'];?>"></input></td>
                   <td><input type="text" name="fifth_<?php echo $to_show['AssessmentID'];?>"></input></td>
               </tr>
        <?php $count++;
       }?>
        <tr><td colspan="2">Semester</td><td colspan="5"><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
        <tr><td colspan="2">Action</td><td colspan="5"><input style="width:20em" type="submit" name="submit" value="Apply Configuration"</td></tr>
         </table> 
         </form>
         <?php
       
    }
    
    public function settings_config($syear){
        $_SESSION['page']="Settings Override";
        ?>
        <center>
        <table class="cog_etry">
            <caption class="cog_etry">Settings Configuration</caption>
            <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
            <tr><td>S.Y</td><td><select name="syear"><?php 
                                         echo "<option selected value='".date('Y')."'>".date('Y')."-".(date('Y')+1)."</option>";
                                foreach($syear as $pasukan){
                                            $susi = key($pasukan);                                             
                                            echo "<option value='".$susi."'>".$pasukan[$susi]."</option>";}?></select></td></tr>
            <tr><td>Action</td><td><input type="submit" name="submit" value="Apply Settings"></td></tr>
            </form>
         </table>   
           </center>
        <?php
    }
    
}
  ?>